<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="_token" content="{{ csrf_token() }}"/>
    <title>上海宏邦知识产权代理有限公司</title>
    <link rel="Shortcut Icon" href="{{asset('admin_assets/img/HB.ico') }}"/>
    <link rel="Bookmark" href="{{asset('admin_assets/img/HB.ico') }}"/>
    <link rel="stylesheet" type="text/css" href="{{asset('admin_assets/css/bootstrap.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('admin_assets/css/font-awesome/css/font-awesome.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('admin_assets/css/AdminLTE.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('css/ladda.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('css/ladda-themeless.min.css')}}">
    <style>
        html body {
            margin: 0;
            height: 100%;
        }

        #body {
            width: 100%;
            height: 100%;
            overflow-x: hidden;
            overflow-y: hidden;
            position: relative;
        }

        #header {
            width: 100%;
            height: 100px;
            position: fixed;
            top: 0;
        }

        #header-left {
            width: 100%;
            min-width: 250px;
            font-size: 20px;
            color: #676767;
            float: left;
        }

        #header-left #login_logo {
            float: left;
            width: 180px;
            height: 45px;
            margin-top: 25px;
            margin-left: 30px;
        }

        #header-left #login_hotline {
            float: right;
            width: 180px;
            height: 45px;
            margin-top: 30px;
            margin-right: 30px;
        }

        /*#header-right{*/
        /*width: 50%;*/
        /*height: 100%;*/
        /*float: right;*/
        /*}*/
        #content {
            width: 100%;
            height: 70%;
            margin-top: 100px;
            background: url("{{asset('admin_assets/img/userlogin_bg.png')}}") no-repeat;
            background-size: cover;
        }

        #content #login-form {
            width: 320px;
            height: 340px;
            background: white;
            float: right;
            border-radius: 5px;
            margin-right: 6%;
            margin-top: 6%;
        }

        #content #login-form form {
            width: 100%;
            height: 100%;
        }

        .input-group .input-group-addon {
            border-radius: 5px 0 0 5px;
        }

        .login_input {
            border-radius: 0 5px 5px 0;
        }

        .verification_code_img {
            width: 100%;
            height: 34px;
            border-radius: 5px;
            cursor: pointer
        }

        #login-btn {
            width: 100%;
            height: 38px;
            outline: none;
            background-color: #f39c12;
            border: none;
            border-radius: 3px;
            display: block;
            color: white;

        }

        #footer {
            width: 100%;
            margin: 0;
            position: fixed;
            bottom: 0;
            height: 80px;
        }

        #footer_title {
            width: 100%;
            text-align: center;
            bottom: 30px;
            color: #a8a8a9;
        }

        .footer_node {
            width: 100%;
            text-align: center;
            bottom: 5px;
            color: #a8a8a9;
        }

        .error {
            color: #d90003;
            margin-top: 1%;
            display: none;
        }
    </style>
</head>
<body>
<div id="body">
    <div id="header">
        <div id="header-left">
            <img id="login_logo" src="{{asset('admin_assets/img/ip_login_logo.png')}}">
            <img id="login_hotline" src="{{asset('admin_assets/img/hotline.png')}}">
        </div>
    </div>
    <div id="content">
        <div id="login-form">
            <form action="{{url('user/user/doLogin')}}" method="post" enctype="multipart/form-data"
                  onsubmit="return check_login();">
                {{ csrf_field() }}
                <div class="row" style="margin-top: 8%">
                    <div class="col-lg-10 col-md-10 col-sm-12 col-xs-12 col-lg-offset-1 col-md-offset-1">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="fa fa-user fa-lg"
                                                               style="color: #0080ff"></i></span>
                            <input id="login_account" name="login_account" type="text" class="form-control login_input"
                                   placeholder="用户名">
                        </div>
                    </div>
                </div>
                <div class="row" style="margin-top: 8%">
                    <div class="col-lg-10 col-md-10 col-sm-12 col-xs-12 col-lg-offset-1 col-md-offset-1">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="fa fa-unlock-alt fa-lg"
                                                               style="color: #0080ff"></i></span>
                            <input id="login_pwd" name="login_pwd" type="password" class="form-control login_input"
                                   placeholder="密&nbsp;&nbsp;&nbsp;&nbsp;码">
                        </div>
                    </div>
                </div>
                <div class="row" style="margin-top: 8%">
                    <div class="col-lg-10 col-md-10 col-sm-12 col-xs-12 col-lg-offset-1 col-md-offset-1">
                        <div class="row">
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                                <input id="verification_code" name="verification_code" type="text" class="form-control"
                                       placeholder="验证码" style="border-radius: 5px">
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                                <img class="verification_code_img" src="{{url('user/user/captcha')}}"
                                     onclick="this.src='{{url('user/user/captcha')}}?'+Math.random()">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row" style="margin-top: 8%">
                    <div class="col-lg-10 col-md-10 col-sm-12 col-xs-12 col-lg-offset-1 col-md-offset-1">
                        <section class="button-demo">
                            <button id="login-btn" class="ladda-button" type="submit" data-style="zoom-out"
                                    style="font-size: 14px;padding-top: 8px;">登录
                            </button>
                        </section>
                        <p class="error" id="error_empty_account"><i class="fa fa-close"></i>用户名为空</p>
                        <p class="error" id="error_empty_password"><i class="fa fa-close"></i>密码为空</p>
                        <p class="error" id="error_empty_code"><i class="fa fa-close"></i>验证码为空</p>
                        <p class="error" id="error_code"><i class="fa fa-close"></i>验证码错误</p>
                        <p class="error" id="error_user"><i class="fa fa-close"></i>用户名或密码错误</p>
                    </div>
                </div>
                <div class="row" style="margin-top: 6%">
                    <div class="col-lg-10 col-md-10 col-sm-12 col-xs-12 col-lg-offset-1 col-md-offset-1">
                        <p style="float: right"><a href="{{url('user/forgetPassword/forgetPasswordIndex')}}"
                                                   id="forgot_password">忘记密码</a>&nbsp;|&nbsp;<a
                                    href="{{url('user/register/register_index')}}" id="go_to_register">立即注册</a></p>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div id="footer">
        <p id="footer_title">宏邦知识产权代理有限公司版权所有&nbsp;&nbsp;备案号：&nbsp;&nbsp;京ICP备15031491号-2</p>
        <p class="footer_node">
            中华全国专利代理人协会会员单位&nbsp;&nbsp;国家火炬互联网创业中心基地制定服务机构
            &nbsp;&nbsp;中华商标协会常务理事单位&nbsp;&nbsp;中国知识产权研究会高级会员&nbsp;&nbsp;国际保护知识产权协会（AIPPI）会员单位&nbsp;&nbsp;
            上海市创业投资行业协会会员单位&nbsp;&nbsp;
        </p>
    </div>
</div>
<script src="{{asset('admin_assets/js/jquery.min.js')}}"></script>
<script src="{{asset('admin_assets/js/bootstrap.min.js')}}"></script>
<script src="{{asset('js/ip.js')}}"></script>
<script src="{{asset('js/spin.min.js')}}"></script>
<script src="{{asset('js/ladda.min.js')}}"></script>
<script>
    $(function () {
        change_view();
        setInterval(change_view, 2000);
    });
    var l = Ladda.create(document.querySelector('.ladda-button'));
    function check_login() {

        var ajaxFlag = true;
        var account = $("#login_account").val();//同户名
        var password = $("#login_pwd").val();//密码
        var code = $("#verification_code").val();//验证码
        if (account.length == 0) {
            $(".error").css('display', 'none');
            $("#error_empty_account").css('display', 'block');
            return false;
        } else if (password.length == 0) {
            $(".error").css('display', 'none');
            $("#error_empty_password").css('display', 'block');
            return false;
        } else if (code == 0) {
            $(".error").css('display', 'none');
            $("#error_empty_code").css('display', 'block');
            return false;
        } else {
            $.ajax({
                type: 'post',
                url: '{{url("user/user/ajaxSubmitCheck")}}',
                data: {'code': code, 'account': account, 'password': password},
                dataType: "json",
                async: false,
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                },
                success: function (data) {
                    console.log(data);
                     // alert('1');
                    if (data == 0) {//验证失败
                        $(".error").css('display', 'none');
                        $("#error_code").css('display', 'block');
                        ajaxFlag = false;
                    }
                    else if (data == 2) {//验证成功
                        $(".error").css('display', 'none');
                        $("#error_user").css('display', 'block');
                        ajaxFlag = false;
                    }
                    else if (data == 1) {//用户名或密码错误
                        $(".error").css('display', 'none');
                        ajaxFlag = true;
                    }
                },
                error: function (data) {
                    console.log(data);
                    ajaxFlag = false;
                }
            });
            if (!ajaxFlag) {
                return false;
            } else {
                l.start();
                return true;
            }
        }

    }

    function change_view() {
        if (screen.width <= 768) {
            self.location = '{{url('user/user/little_login')}}';
        }
    }
</script>
</body>
</html>
